<template>
  <div>
    <!--      <div>入职管理</div>-->
    <el-row>
      <el-col :offset="1">
        <el-button type="primary" @click="dialogVisible = true">添加入职</el-button>
      </el-col>
    </el-row>
    <el-table
      :data="tableData"
      border
      style="width: 100%;margin:30px;">
      <!--        <el-table-column-->
      <!--          fixed-->
      <!--          prop="date"-->
      <!--          label="日期"-->
      <!--          width="150">-->
      <!--        </el-table-column>-->
      <el-table-column
        fixed
        prop="name"
        label="姓名"
        width="120">
      </el-table-column>
      <el-table-column
        prop="education_background"
        label="学历"
        width="120">
      </el-table-column>
      <el-table-column
        prop="graduate_school"
        label="毕业院校"
        width="120">
      </el-table-column>
      <el-table-column
        prop="phone"
        label="联系电话"
        width="120">
      </el-table-column>
      <el-table-column
        prop="submit_date"
        label="提交日期"
        width="120">
      </el-table-column>
      <!--        <el-table-column-->
      <!--          prop="state"-->
      <!--          label="状态"-->
      <!--          width="300">-->
      <!--        </el-table-column>-->


      <el-table-column
        fixed="right"
        label="操作"
        width="100">
        <template slot-scope="scope">
          <el-button @click="handleClick(scope.row)" type="text" size="small">同意</el-button>
          <el-button type="text" size="small">拒绝</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-dialog
      title="添加入职"
      @close="close"
      :visible.sync="dialogVisible">
      <el-form :model="form" :rules="rules" ref="formRef">
        <el-form-item label="员工身份证号" prop="IDcard" :label-width="formLabelWidth">
          <el-input v-model="form.IDcard" autocomplete="off"/>
        </el-form-item>
        <el-form-item label="员工姓名" prop="name" :label-width="formLabelWidth">
          <el-input v-model="form.name" autocomplete="off"/>
        </el-form-item>

      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="addEmployee">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
  export default {
    methods: {
      handleClick(row) {
        console.log(row);
      },
      close(){
        this.form.IDcard='';
        this.form.name='';
      },
      addEmployee(){

      }
    },
    data() {

      return {
        rules:{
          IDcard:[
            {min:18,max:18,required: true,message:'身份证长度不正确',trigger: 'blur'}
          ],
          name:[
            {required: true,message:'请输入用户名'}
          ]
        },
        dialogVisible: false,
        form: {
          IDcard: "",
          name: ''
        },
        formLabelWidth: '120px',
        tableData: [{
          name: '王小虎',
          education_background: '本科',
          graduate_school: '上海交通大学',
          phone: '18000144774',
          submit_date: '2021-01-01'
        }, {
          name: '王小虎',
          education_background: '本科',
          graduate_school: '上海交通大学',
          phone: '18000144774',
          submit_date: '2021-01-01'
        }, {
          name: '王小虎',
          education_background: '本科',
          graduate_school: '上海交通大学',
          phone: '18000144774',
          submit_date: '2021-01-01'
        }, {
          name: '王小虎',
          education_background: '本科',
          graduate_school: '上海交通大学',
          phone: '18000144774',
          submit_date: '2021-01-01'
        }, {
          name: '王小虎',
          education_background: '本科',
          graduate_school: '上海交通大学',
          phone: '18000144774',
          submit_date: '2021-01-01'
        }, {
          name: '王小虎',
          education_background: '本科',
          graduate_school: '上海交通大学',
          phone: '18000144774',
          submit_date: '2021-01-01'
        }, {
          name: '王小虎',
          education_background: '本科',
          graduate_school: '上海交通大学',
          phone: '18000144774',
          submit_date: '2021-01-01'
        }]
      }
    }
  }
</script>

<style>

</style>
